<template>
<div class="basic-setting-content pl16 pr16">
    <!--规格设置-->
    <div class="common-form">{{$t('product.spec_stock')}}</div>

    <!--减库存方式-->
    <el-form-item :label="$t('product.stock_calc_method')">
      <el-radio-group v-model="form.model.deductStockType">
        <el-radio :label="10">{{$t('product.stock_on_order')}}</el-radio>
        <el-radio :label="20">{{$t('product.stock_on_payment')}}</el-radio>
      </el-radio-group>
    </el-form-item>

    <el-form-item :label="$t('product.product_spec_label')">
      <el-radio-group v-model="form.model.specType">
        <el-radio :label="10" v-if="!form.isSpecLocked || form.isSpecLocked && form.model.specType == 10">{{$t('product.single_spec')}}</el-radio>
        <el-radio :label="20" v-if="!form.isSpecLocked || form.isSpecLocked && form.model.specType == 20">{{$t('product.multi_spec')}}</el-radio>
      </el-radio-group>
      <div v-if="form.isSpecLocked" class="red">{{$t('product.spec_edit_disabled')}}</div>
    </el-form-item>

    <!--单规格-->
    <template v-if="form.model.specType == 10">
      <Single></Single>
    </template>

    <!--多规格-->
    <template v-if="form.model.specType == 20">
      <Many></Many>
    </template>

  </div>
</template>

<script>
import Single from './spec/Single.vue';
import Many from './spec/Many.vue';
export default {
  components: {
    /*单规格*/
    Single,
    /*多规格*/
    Many
  },
  inject: ['form']
};
</script>

